/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#ifndef LIB2D_HARD_SOFT_IMAGE_H
#define LIB2D_HARD_SOFT_IMAGE_H

#include <lib2d/hard/Image.h>
#include <ColorPacked.h>
#include <Array2D.h>

namespace liba
{
namespace lib2d
{
namespace hard
{
namespace soft
{

class Renderer;

class Image : public hard::Image
{
	Renderer * renderer;
	int width;
	int height;
	Array2D<ColorPacked> canvas;
	friend class Renderer;
	Image( Renderer * renderer, int sx, int sy );
public:
	virtual ~Image()
	{}
	virtual bool is_valid()const
	{
		return true;
	}
	virtual pictureformat::Format get_format()const
	{
		return pictureformat::A8R8G8B8;
	}
	virtual void blit( const Vector2 & dst, const Rect & rect, int alpha );
	virtual void blit( const Vector2 & dst, int alpha );
	virtual void fill_rect( const Rect & dst_rect, int alpha = 255 );
	virtual void fill_rect( const Rect & dst_rect, const Rect & src_rect, int alpha = 255 );
	virtual void * lock( int * stride );
	virtual void unlock()
	{}
	virtual int get_width()const
	{
		return canvas.cx();
	}
	virtual int get_height()const
	{
		return canvas.cy();
	}

};

} //namespace soft
} //namespace hard
} //namespace lib2d
} //namespace liba

using namespace liba;

#endif //LIB2D_HARD_SOFT_IMAGE_H
